﻿$(document).ready(function () {
    //错误提示框
    $('#alert').dialog({
        bgiframe: true,
        autoOpen: false,
        width: 300,
        modal: true,
        resizable: false,
        buttons: {
            " 确定 ": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#alertinfo').dialog({
        bgiframe: true,
        autoOpen: false,
        dialogClass: "my-dialog",
        width: 300,
        modal: true,
        resizable: false,
        open: function (event, ui) {
            $(".ui-dialog-titlebar-close", $(this).parent()).hide();
        },
        buttons: {
            " 确定 ": function () {
                $(this).dialog("close");
            }
        }
    });

    $('#progress').dialog({
        bgiframe: true,
        autoOpen: false,
        closeOnEscape: false,
        resizable: false,
        dialogClass: 'progress',
        width: 300,
        modal: true
    });
});
//显示进度条
function ShowProgress() {
    $('#progressbar').progressbar({
        value: 100
    });
    $('#progress').dialog('open');
}
//隐藏进度条
function HideProgress() {
    $('#progress').dialog('close');
}

//显示警告对话框
function ShowDialog(txt) {
    $('#alerttext').html(txt);
    $('#alert').dialog('open');
}

//成功提示框
function ShowDialogInfo(txt) {
    $("#alerttextinfo").html(txt);
    $("#alertinfo").dialog('open');
}

function ShowDialogInfoG(txt, url) {
    if (txt.indexOf("认证") != -1) {
        $("#alerttextinfo").html(txt);
        //设置
        $('#alertinfo').dialog('option', 'buttons', { "确定": function () { window.location.href = "/User/upsfz.aspx"; } });
        $("#alertinfo").dialog('open');
    }
    else {
        $("#alerttextinfo").html(txt);
        //设置
        $('#alertinfo').dialog('option', 'buttons', { "确定": function () { window.location.href = url; } });
        $("#alertinfo").dialog('open');
    }
}


function ShowDialogInfoAndOpen(txt, url) {
    
        $("#alerttextinfo").html(txt);
        //设置
        $('#alertinfo').dialog('option', 'buttons', { "确定": function () { window.open(url); $("#alertinfo").dialog('close'); } });
        $("#alertinfo").dialog('open');
}


function ShowCz(txt) {
    $("#alerttextinfo").html(txt);
    $('#alertinfo').dialog('option', 'buttons', {
        "充值成功":
            function () {
                window.location.href = document.URL;
            },
        "充值失败":
            function () {
                window.location.href = document.URL;
            }
    });
    $("#alertinfo").dialog('open');
}